<template>
  <div class="solutionTab-container">
    <div class="tabs">
      <div
        v-for="(item, index) in tabs"
        :key="index"
        class="tab"
        :class="{active: active === index}"
        @click="toogle(index)"
      >
        <!-- <el-checkbox
          v-model="item.checked"
          style="margin-right:5px;"
        ></el-checkbox> -->
        <i
          class="el-icon-circle-check check-icon"
          :class="{active: item.checked}"
          @click="item.checked = !item.checked"
        ></i>
        {{ item.name }}
      </div>
    </div>
    <div v-show="active === 0" class="content content1">
      <div class="content-con">
        <div class="left">
          <div
            v-for="(item, index) in handList.list.slice(0, 8)"
            :key="index"
            class="item"
          >
            <span class="index">{{ index + 1 }}.</span>
            {{ item.hand }}
          </div>
        </div>
        <div class="right">
          <div
            v-for="(item, index) in handList.list.slice(
              8,
              handList.list.length
            )"
            :key="index"
            class="item"
          >
            <span class="index">{{ index + 9 }}.</span>
            {{ item.hand }}
          </div>
          <span class="index">共计:{{ handList.time }}分钟</span>
        </div>
      </div>
      <div class="bottom-desc"></div>
    </div>
    <div v-show="active === 1" class="content content2">
      <div class="content-con">
        <div v-show="handListSimple.list.length > 0" class="left">
          <div
            v-for="(item, index) in handListSimple.list.slice(0, 8)"
            :key="index"
            class="item"
          >
            <span class="index">{{ index + 1 }}.</span>
            {{ item.hand }}
          </div>
        </div>
        <div v-show="handListSimple.list.length > 0" class="right">
          <div
            v-for="(item, index) in handListSimple.list.slice(
              8,
              handList.list.length
            )"
            :key="index"
            class="item"
          >
            <span class="index">{{ index + 9 }}.</span>
            {{ item.hand }}
          </div>
          <span class="index">共计:{{ handListSimple.time }}分钟</span>
        </div>
      </div>
      <div class="bottom-desc"></div>
    </div>
    <div v-show="active === 2" class="content content3">
      <div class="content-con">
        <div v-if="!foodList.length" class="no-content">
          <img class="image" width="130" src="@/assets/img/food.png" />
          <div>六个月以内的宝宝以母乳或配方奶粉为主</div>
        </div>
        <template v-else>
          <div v-for="item in foodList" :key="item.id" class="item">
            <div class="food-name">{{ item.food }}</div>
            <div class="food-content">
              <span class="bold">食材：</span>{{ item.food_detail }}
            </div>
            <div class="food-content">
              <span class="bold">做法：</span>
              <!-- eslint-disable-next-line vue/no-v-html -->
              <div v-html="item.food_do"></div>
            </div>
          </div>
        </template>
      </div>
      <div class="bottom-desc">
        <template v-if="foodBook && foodBook.length > 0">
          <span
            style="color:#4b90ff;margin-right:10px; line-height: 40px; margin-left: 20px;"
            >参考文献：</span
          >
          <span>{{ foodBook.join(' ') }}</span>
        </template>
      </div>
    </div>
    <div v-show="active === 3" class="content content4">
      <div class="content-con">
        <div v-if="!sayList.length" class="no-content">
          <img class="image" src="@/assets/img/no-content.png" />
        </div>
        <template v-else>
          <div v-for="(item, index) in sayList" :key="item.id" class="item">
            <span class="index">{{ index + 1 }}.</span>{{ item.doctor_say }}
          </div>
          <section class="sayList-taboo">
            <div v-if="suitList.length > 0" class="taboo-title">食宜</div>
            <div v-for="(item, index) in suitList" :key="item.id" class="item">
              <span class="index">{{ index + 1 }}.</span>{{ item.cannot_name }}
            </div>
            <div v-if="cannotList.length > 0" class="taboo-title">食忌</div>
            <div
              v-for="(item, index) in cannotList"
              :key="item.id"
              class="item"
            >
              <span class="index">{{ index + 1 }}.</span>{{ item.cannot_name }}
            </div>
          </section>
        </template>
      </div>
      <div class="bottom-desc"></div>
    </div>
  </div>
</template>
<script>
export default {
  components: {},
  props: {
    progress: {},
    handList: {},
    handListSimple: {},
    sayList: {},
    suitList: {
      type: Array,
      default: () => []
    },
    cannotList: {
      type: Array,
      default: () => []
    },
    foodList: {},
    foodBook: {
      type: Array,
      default: () => []
    }
  },
  data() {
    return {
      tabs: [
        {name: '标准方案', checked: true},
        {name: '快捷方案', checked: false},
        {name: '食疗方案', checked: false},
        {name: '调护建议', checked: false}
      ],
      active: 0,
      checked: false
    };
  },
  created() {},
  methods: {
    toogle(index) {
      this.active = index;
    }
  }
};
</script>
<style lang="scss" scoped>
.solutionTab-container {
  .solution-desc-box {
    background-color: #fff;
    .bottom-desc {
      font-size: 10px;
      padding: 10px 20px;
    }
  }
  .solution-desc {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    font-size: 16px;
    .solution-block {
      width: 49%;
      background-color: #f2f6ff;
      padding: 20px;
      box-sizing: border-box;
      .title {
        font-size: 16px;
        color: #4b90ff;
        margin-bottom: 20px;
      }
      .list {
        line-height: 30px;
        color: #333;
      }
    }
  }
  .tabs {
    display: flex;
    .tab {
      display: flex;
      justify-content: center;
      align-items: center;
      width: 176px;
      height: 40px;
      background-color: #fff;
      font-size: 16px;
      font-weight: bold;
      box-sizing: border-box;
      margin-right: 10px;
      color: #333;
      cursor: pointer;
      border-top: 2px solid transparent;
      border-bottom: 1px solid #f3f4f6;
      &.active {
        border-top: 2px solid #4b90ff;
        color: #4b90ff;
        border-bottom: 1px solid transparent;
      }
      &:last-child {
        margin-right: 0;
      }
    }
  }
  .check-icon {
    margin-right: 6px;
    font-size: 16px;
    color: #333;
    &.active {
      color: #4b90ff;
    }
  }
  .content {
    background-color: #fff;
    .content-con {
      background-color: #f2f6ff;
      height: 265px;
      font-size: 16px;
      box-sizing: border-box;
      padding: 10px 20px;
      color: #333;
      overflow-y: auto;
      overflow-x: hidden;
      .no-content {
        display: flex;
        height: 100%;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        font-size: 16px;
      }
      .sayList-taboo {
        margin-top: 30px;
        .taboo-title {
          font-weight: bold;
          font-size: 18px;
        }
      }
    }
    .bottom-desc {
      height: 40px;
    }
    .index {
      color: #4b90ff;
      margin-right: 10px;
    }
  }
  .content1 .content-con,
  .content2 .content-con {
    display: flex;
    line-height: 30px;
  }
  .content1 .left,
  .content1 .right,
  .content2 .left,
  .content2 .right {
    flex-grow: 1;
    width: 100px;
  }
  .content1 .item {
    // margin-right: 102px;
    width: 213px;
  }
  .content2 .item {
    // margin-right: 102px;
    width: 213px;
  }
  .content3 .content-con,
  .content4 .content-con {
    line-height: 30px;
  }
  .content3 {
    .food-name,
    .food-content .bold {
      font-weight: bold;
    }
    .food-name {
      color: #4b90ff;
    }
    .item {
      margin-top: 20px;
      &:first-child {
        margin-top: 0;
      }
    }
  }
}
</style>
<style lang="scss">
.image {
  display: block;
  margin: 10px;
}
</style>
<style lang="scss">
.solutionTab-container {
  .el-checkbox__input.is-checked + .el-checkbox__label {
    color: #333;
  }
}
</style>
